package planeWar.src.com.bjsxt.plane;

import java.awt.*;

public class Shell extends GameObject{
    double degree;
    public Shell(){
        x=200;
        y=200;
        degree = Math.random()* Math.PI*2;
        width=6;
        height = 6;
        speed=3;

    }

    @Override
    public void drawMyself(Graphics g) {
        Color c= g.getColor();
        g.setColor(Color.yellow);
        g.drawOval((int)x,(int)y,width,height);
        g.setColor(c);
        x+=speed*Math.cos(degree);
        y+=speed*Math.sin(degree);
        if (y>Context.GAME_HEIGHT-this.height||y<36){
            degree=-degree;
        }
        if (x<0||x>Context.GAME_WIDTH-this.width){
            degree = Math.PI-degree;
        }
    }
}
